// File:    Estado.cs
// Author:  Lucas Bittencourt
// Created: quarta-feira, 16 de novembro de 2011 18:32:47
// Purpose: Definition of Class Estado

using System;
using System.Text;

namespace DA_OOMModel
{
   public class Estado
   {
       private int estIdEstado;
       private string estSgEstado;
       private string estNmEstado;
       private decimal estCdIbge;

       private Iesi.Collections.ISet cidade;
      
      /// <summary>
      /// Property for collection of Cidade
      /// </summary>
      /// <pdGenerated>Default opposite class collection property</pdGenerated>
      public virtual Iesi.Collections.ISet Cidade
      {
         get
         {
            return cidade;
         }
         set
         {
            this.cidade = value;         
         }
      }
      private Iesi.Collections.ISet endereco;
      
      /// <summary>
      /// Property for collection of Endereco
      /// </summary>
      /// <pdGenerated>Default opposite class collection property</pdGenerated>
      public virtual Iesi.Collections.ISet Endereco
      {
         get
         {
            return endereco;
         }
         set
         {
            this.endereco = value;         
         }
      }
   
      /// <summary>
      /// Get value of property EstIdEstado.
      /// </summary>
      public virtual int EstIdEstado
      {
         get
         {
            return estIdEstado;
         }
         set
         {
            if (this.estIdEstado != value)
               this.estIdEstado = value;
         }
      }
      
      /// <summary>
      /// Get value of property EstSgEstado.
      /// </summary>
      public virtual string EstSgEstado
      {
         get
         {
            return estSgEstado;
         }
         set
         {
            if (this.estSgEstado != value)
               this.estSgEstado = value;
         }
      }
      
      /// <summary>
      /// Get value of property EstNmEstado.
      /// </summary>
      public virtual string EstNmEstado
      {
         get
         {
            return estNmEstado;
         }
         set
         {
            if (this.estNmEstado != value)
               this.estNmEstado = value;
         }
      }
      
      /// <summary>
      /// Get value of property EstCdIbge.
      /// </summary>
      public virtual decimal EstCdIbge
      {
         get
         {
            return estCdIbge;
         }
         set
         {
            if (this.estCdIbge != value)
               this.estCdIbge = value;
         }
      }
   
      /// <summary>
      /// Get and set primary key class
      /// </summary>
      public virtual EstadoPK EstadoPK
      {
         get 
         {
            return new EstadoPK(estIdEstado);
         }
         set
         {
            if (value != null)
            {
               this.estIdEstado = value.EstIdEstado;
            }
         }
      }
   
      /// <summary>
      /// Get hash code
      /// </summary>
      /// <pdGenerated>Get hash code</pdGenerated>
      public override int GetHashCode()
      {
         int _hashCode = 0;
         _hashCode = 29 * EstadoPK.GetHashCode();
         if (this.estSgEstado != null) 
            _hashCode += 29 * estSgEstado.GetHashCode();
      
         if (this.estNmEstado != null) 
            _hashCode += 29 * estNmEstado.GetHashCode();
      
         _hashCode += 29 * estCdIbge.GetHashCode();
         return _hashCode;
      }
   
      /// <summary>
      /// Test if two objects are equal
      /// </summary>
      /// <param name="object">Object to compare</param>
      /// <pdGenerated>Test if two objects are equal</pdGenerated>
      public override bool Equals(object obj)
      {
         if (obj == null)
            return false;
         Estado cast = obj as Estado;
         if (!(obj is Estado))
            return false;
         if (!this.EstadoPK.Equals(cast.EstadoPK))
            return false;
         if (this.estIdEstado != cast.EstIdEstado)
            return false;
         if (String.Equals(this.estSgEstado, cast.EstSgEstado) == false)
            return false;
      
         if (String.Equals(this.estNmEstado, cast.EstNmEstado) == false)
            return false;
      
         if (this.estCdIbge != cast.EstCdIbge)
            return false;
      
         return true;
      }
   
      /// <summary>
      /// Get object in string format
      /// </summary>
      /// <pdGenerated>Get object in string format</pdGenerated>
      public override string ToString()
      {
         StringBuilder ret = new StringBuilder();
         ret.Append( "Estado: " );
         ret.Append( "EstIdEstado='" + estIdEstado.ToString() + "'");
         if (estSgEstado != null)
            ret.Append( "EstSgEstado='" + estSgEstado.ToString() + "'");
         if (estNmEstado != null)
            ret.Append( "EstNmEstado='" + estNmEstado.ToString() + "'");
         ret.Append( "EstCdIbge='" + estCdIbge.ToString() + "'");
         return ret.ToString();
      }
   
   }
}